@extends('layout.admin')

@section('content')
<div class="container">
	<div class="row">
        <div class="span2">
        	<div class="well sidebar-nav">
        		<ul class="nav nav-list">
        			<li class="nav-header">菜单</li>
        			<li class="active"><a href="{{URL::to('admin/user')}}"><i class="icon-th-list"></i>
        					用户列表</a></li>
        			<li><a href="{{URL::to('admin/user/create')}}"><i
        					class="icon-pencil"></i> 添加用户</a></li>
        		</ul>
        	</div>
        </div>
	
		<div class="span10">
			<ul class="breadcrumb">
				<li><a href="{{ URL::to('admin') }}">首页</a> <span class="divider">/</span></li>
				<li><a href="{{ URL::to('admin/user') }}">用户管理</a> <span class="divider">/</span></li>
				<li class="active">用户列表</li>
			</ul>
            
<!-- will be used to show any messages -->
@if (Session::has('message'))
	<div class="alert alert-info" >
	<button type="button" class="close" data-dismiss="alert">×</button>
	{{ Session::get('message') }}
	</div>
@endif
            
            <table class="table">
              <thead>
                <tr>
                  <th>ID</th>
                  <th>用户名</th>
                  <th>邮箱</th>
                  <th>创建时间</th>
                  <th>操作</th>
                </tr>
              </thead>
              <tbody>
              
              @foreach($users as $user)
                <tr>
                  <td>{{$user->id}}</td>
                  <td>{{$user->username}}</td>
                  <td>{{$user->email}}</td>
                  <td>{{$user->created_at}}</td>
                  <td>
                @if ($user->id != 1)
                {{ Form::open(array('url' => 'admin/user/' . $user->id, 'class' => 'pull-right')) }}
                	{{ Form::hidden('_method', 'DELETE') }}
                	{{ Form::submit('删除', ['class' => 'btn btn-warning', 'onclick' => 'return confirm("确定删除么？")']) }}
                {{ Form::close() }}
                @endif

                <a class="btn btn-small btn-success" href="{{ URL::to('admin/user/' . $user->id) }}">查看</a>
                <a class="btn btn-small btn-info" href="{{ URL::to('admin/user/' . $user->id . '/edit') }}">编辑</a>
				
                  </td>
                </tr>
              @endforeach
              
                <tr>
                  <td colspan="100">{{$users->links()}}</td>
                </tr>
              </tbody>
            </table>
            

		</div>

	</div>
</div>
@stop

